package com.java.laixiangdong.express.server;

import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.ServerSocket;
import java.net.Socket;

/**
 * @Author: laixiangdong
 * @Date 2020/10/26
 */
public class ServerExpressPlaceRead {
    public static void main(String[] args) throws IOException {
        ServerSocket server = new ServerSocket(56604);

        while (true) {
            Socket socket = server.accept();
            new Thread(() -> {
                try {
                    OutputStream outputStream = socket.getOutputStream();
                    InputStream inputStream = new FileInputStream("expressPlaces.save");
                    byte[] bytes = inputStream.readAllBytes();
                    outputStream.write(bytes);
                    System.out.println("读取expressPlaces.save成功");
                } catch (IOException e) {
                    e.printStackTrace();
                    System.out.println("读取expressPlaces.save失败");
                }
            }).start();
        }
    }
}
